home *** CD-ROM | disk | FTP | other *** search
Wrap
XSetup plugin | 2004-03-02 | 6.8 KB | 223 lines
"FILE"="Xteq Systems X-Setup Plugin 5.0" "TYPE"="8" "COUNT"="2" "UIPATH 1"="Internet\Internet Explorer\Files&Folders" "UIPATH 2"="Virtual Paranoia\Security Related" "NAME"="Silently Executed Files" "VERSION"="1.04" "LANGUAGE"="VBScript" "TEXT 1"="Add" "TEXT 2"="Remove" "DESCRIPTION 1"=For every file that Internet Explorer downloads, you will be asked to open it directly or save it to disk. You might decide that some files should be started automatically after the download by selecting the checkbox inside the Internet Explorer dialog box. "DESCRIPTION 2"=When this checkbox is selected, you have created a "Silently Executed File". This means: If Internet Explorer comes across a filename with an extension that is marked with "Do not ask me again" checkbox, it will automatically start the program responsible for that file. "DESCRIPTION 3"=Basically this is a good idea, but some programs automatically set this "Do not ask me again" flag and thus you never ever have the chance to decide if you maybe want to be asked if a file of that type is downloaded. "DESCRIPTION 4"=All entries in this list are marked "Do not ask me again" and thus are "Silently Executed Files". To add a file to this list and start it automatically, click the Add button. To have the dialog box that will ask you what to do with a file, select the entry in the list and click on the Remove button. "AUTHOR"="Xteq Systems" "CONTACTURL"="http://www.xteq.com" "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved" "COMMENT 1"="Thanks to Pierre Szwarc for the idea!" "COMMENT 2"="check also: http://ntbugtraq.ntadvice.com/default.asp?pid=55&did=32" sMainPath="HKLM\Software\Classes\" sEditFlags="\EditFlags" dim iItems 'contains the total amount of the registry keys dim aryItems() dim iRealItems 'contains the total amount of items! 'Dim aryItems() 'contains the name of the Registry paths (direct files starting with ".") 'Dim aryItemsLoc() 'contains the registry location (\ShellNew or \ShellNew-) 'Dim aryDesc() 'contains the description of the items Sub Plugin_Initialize if RegPathExists(sMainPath) then iRealItems=0 Call ReadRegistry else Call Disable end if End Sub Sub ReadRegistry for i=1 to iRealItems Call SetUIElement(i,"") next iRealItems=0 ReDim aryItems(505) 'hard coded! l=1 e=1 iItems=RegEnumPaths(sMainPath) sDebug="" sItem="" sRealFileType="" sRealFileTypeDesc="" sDataVal="" 'read all data from the path For l=1 to iItems sItem=RegEnumElement(l) if left(sItem,1)="." then 'read the real file type sRealFileType=RegReadValue(sMainPath & sItem & "\@") 'get the value of edit flags from the real data type sDataVal=RegReadValue(sMainPath & sRealFileType & sEditFlags) 'get the desc sRealFileTypeDesc=RegReadValue(sMainPath & sRealFileType & "\@") if len(sRealFileTypeDesc)=0 then sRealFileTypeDesc=sRealFileType end if 'desc too long? if len(sRealFileTypeDesc)>35 then sRealFileTypeDesc=left(sRealFileTypeDesc,35) & "..." end if 'now check the data value if len(sDataVal)>=6 then 'since we are interessted in the third bit xxYYzz = 6 chars if mid(sDataVal,5,2)="01" then iRealItems=iRealItems+1 if iRealItems>504 then exit sub 'hard coded II aryItems(iRealItems)=sRealFileType Call SetUIElement(iRealItems,sITEM & " - " & sRealFileTypeDesc ) end if end if end if next 'Call DebugMsg(sDebug) Exit Sub End Sub 'VERSION 1.1 'returns the readable description for a file TYPE. Input is the 'raw file type (e.g. ".TXT"). Function GetFileDescription(DotType) sxd_BasePath="HKLM\Software\Classes\" sxd_Path=sxd_BasePath & DotType & "\@" sxd_Val=RegReadValue(sxd_Path) if IsEmpty(sxd_Val)=true then 'extended description not found! return default GetFileDescription="<UNKNOWN>" else 'found, now get the "real" description sxd_Path=sxd_BasePath & sxd_Val & "\@" sxd_Name=RegReadValue(sxd_Path) if IsEmpty(sxd_Name)=true then 'argh! GetFileDescription="<UNKNOWN>" else GetFileDescription=sxd_Name end if end if End Function Sub PatchEditFlags(Path,ActivateIt) sP=Path & sEditFlags iType=RegValueType(sP) if iType<>3 then Call MsgError("Unable to change Registry Path <" & sP & "> since the value type is not REG_BINARY. I am sorry that it did not work.") else sVal=CStr(RegReadValue(sP)) sNewVal="" if len(sVal)>=4 then sNewVal=cstr(left(sVal,4)) end if if Len(sNewVal)=0 then sNewVal="0000" end if if ActivateIt=true then sNewVal=sNewVal & "01" else sNewVal=sNewVal & "00" end if if len(sVal)>=7 then sNewVal=sNewVal & Mid(sVal,7,len(sVal)-6) end if Call RegWriteValue(sP,sNewVal,3) end if end sub Sub Plugin_Apply(ElementIndex,ElementSubIndex) bChanged=false if ElementIndex=1 then 'add s=InputWindow("Please enter the extension (without ┤.┤) that should be executed without warning from Internet Explorer. For example, enter ┤DOC`",s,1) if IsEmpty(s)=false then if len(s)>1 then sPath=sMainPath & "." & s & "\@" sRealName=RegReadValue(sPath) if len(sRealName)>0 then if RegPathExists(sMainPath & sRealName) then Call PatchEditFlags(sMainPath & sRealName,true) bChanged=true Call MsgInformation("Extension added, you will find the entry inside the list.") else Call MsgError("Unable to add this extension since the real name for this extension could not be located inside the registry.") end if else Call MsgError("Unable to add this extension as it is not linked to a program.") end if end if end if end if if ElementIndex=2 then 'delete if ElementSubIndex>0 then s=aryItems(ElementSubIndex) Call PatchEditFlags(sMainPath & s,false) Call MsgInformation("Entry removed") bChanged=true else Call MsgWarning("Please select an item in the list.") end if end if if bChanged=true then 're-read UI Call ReadRegistry end if end sub Sub Plugin_Terminate End Sub